<?php
if(isset($_SESSION['QuyenHan']))
{	
	if(isset($_GET['id']))
	$MaVanBanDi = $_GET['id'];
	$vanbandi = new vanbandibs();
	$vanbandi->MaVanBanDi = $MaVanBanDi;
	$danhsach = $vanbandi->GetList();
?>


<div id="NoiDung" class="form">
  <h3  class="text-primary">Chi tiết văn bản <?php echo $danhsach[0]['SovaKyHieu']?></h3>
 
      <table class="table table-bordered table-hover" >
        <tbody >
    	<tr>
        	<td width="150px">
                     <span> <label>Số và ký hiệu: </label></span>      
            </td>
            <td>
                    <span> <?php echo $danhsach[0]['SovaKyHieu']?> </span>
            </td>
        </tr>
        
        <tr>
        	<td width="150px">
                     <span> <label>Trích yếu: </label></span>      
            </td>
            <td>
                    <span> <?php echo $danhsach[0]['TrichYeu']?> </span>
            </td>
        </tr>
        
          <tr>
        	<td width="150px">
                     <span> <label>Ngày ban hành: </label></span>      
            </td>
            <td>
                    <span> <?php echo InNgay($danhsach[0]['NgayBanHanh']) ?> </span>
            </td>
        </tr>
        
         <tr>
        	<td width="150px">
                     <span> <label>Ngày hết hạn: </label></span>      
            </td>
            <td>
                    <span>  <?php echo InNgay($danhsach[0]['NgayHetHan']) ?> </span>
            </td>
        </tr>
        
          <tr>
        	<td width="150px">
                     <span> <label>Loại văn bản: </label></span>      
            </td>
            <td>
                    <span> <?php echo $danhsach[0]['TenLoaiVanBan']?> </span>
            </td>
        </tr>
        
          <tr>
        	<td width="150px">
                     <span> <label>Nơi ban hành: </label></span>      
            </td>
            <td>
                    <span> <?php echo $danhsach[0]['NoiBanHanh']?> </span>
            </td>
        </tr>
        
        
         <tr>
        	<td width="150px">
                     <span> <label>Ngày đăng ký: </label></span>      
            </td>
            <td>
                    <span> <?php echo InNgay($danhsach[0]['NgayDangKy']) ?> </span>
            </td>
        </tr>
        
          <tr>
        	<td width="150px">
                     <span> <label>Nơi đến: </label></span>      
            </td>
            <td>
                    <span>
                    	<?php
						if($danhsach[0]['DonViNgoai'] != "")
							echo $danhsach[0]['DonViNgoai'];
						elseif($danhsach[0]['MaPhongBan'] != 0)
						{
							$phongban = new phongbanbs();
							$phongban->MaPhongBan = $danhsach[0]['MaPhongBan'];
							$dsphongban =$phongban->GetList();
							echo $dsphongban[0]['TenPhongBan'];
						}
						elseif($danhsach[0]['MaNguoiDung'] != 0)
						{
							$nguoidung = new nguoidungbs();
							$nguoidung->MaNguoiDung = $danhsach[0]['MaNguoiDung'];
							$dsnguoidung =$nguoidung->GetList();
							echo $dsnguoidung[0]['TenNguoiDung']."-".$dsnguoidung[0]['TenChucVu'].'-'.$dsnguoidung[0]['TenPhongBan'];
						}else
						{
							echo "Công ty";
						}
						?>
                    
                     </span>
            </td>
        </tr>
     
     
        
        	<?php
            	if( $danhsach[0]['MaTrangThai'] != 5)
				{
					$nguoiduyet = new nguoidungbs();
					$nguoiduyet->MaNguoiDung = $danhsach[0]['MaNguoiDuyet'];
					$nguoiduyet = $nguoiduyet->GetList();
			?>
             <tr>
                <td width="150px">
                         <span> <label>Người duyệt: </label></span>      
                </td>
                <td>
                        <span> <?php  echo $nguoiduyet[0]['TenNguoiDung'] ?> </span>
                </td>
            </tr>
             <tr>
                <td width="150px">
                         <span> <label>Thơi gian duyệt: </label></span>      
                </td>
                <td>
                        <span> <?php  echo $danhsach[0]['ThoiGianDuyet'] ?> </span>
                </td>
            </tr>
            <?php } ?>
       
 		<tr>
                <td width="150px">
                         <span> <label>File đính kèm: </label></span>      
                </td>
                <td>
                        <span> <?php
							$filevb = new filevanbanbs();
							$filevb->MaVanBanDi = $danhsach[0]['MaVanBanDi'];
							$dsfile = $filevb->GetList();
							for($i=0; $i<count($dsfile);$i++)
							{
								
						  		echo "<a href=".$dsfile[$i]['Path']."><span class='glyphicon glyphicon-save'> ".$dsfile[$i]['TenFileVanBan']."</span></a> </br>" ;
								
							}
							?> 
                          	
                          </span>
                </td>
            </tr>
        </tbody>
      </table>
 
</div>
<?php
}else
{
	ThongBaoLoi("Vui lòng đăng nhập !");
}
?>